package com.book.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.book.dao.impl.OrderDaoImpl;
import com.book.dao.impl.OrderItemsDaoImpl;
import com.book.service.OrderService;

@Service
@Transactional
public class OrderServiceImpl implements OrderService{
	@Autowired
	private OrderDaoImpl orderDao;
	
	@Autowired
	private OrderItemsDaoImpl orderItemsDao;
	
	public void buy(Integer bookId){
		//保存订单
		Integer orderId = orderDao.saveOrder();
		
		//保存订单明细
		orderItemsDao.saveItems(bookId,orderId);
		
	}

}
